<template>
  <el-form :model="changePassForm" style="width: 400px; margin: 50px auto">
    <el-form-item label="旧密码">
      <el-input v-model="changePassForm.oldPwd" />
    </el-form-item>
    <el-form-item label="新密码">
      <el-input v-model="changePassForm.newPwd" type="password"/>
    </el-form-item>
    <el-form-item label="确认密码">
      <el-input v-model="changePassForm.confirmPassword" type="password"/>
    </el-form-item>
    <el-button
      type="primary"
      style="width: 100%; margin-top: 30px"
      @click="updatePassword"
      >确 定</el-button
    >
  </el-form>
</template>

<script>
import { changePassword} from "@/api/account";
import {Message} from "element-ui";

export default {
  data() {
    return {
      changePassForm: {
        oldPwd: "",
        newPwd: "",
        confirmPassword: ""
      },
    };
  },
  methods: {
    updatePassword() {
      changePassword(this.changePassForm).then(response => {
        if (response.success === "1") {
          Message.success(response.message);
        } else {
          Message.error(response.message);
        }
      });
    },
  },
};
</script>

<style></style>
